/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio.practica3;

import java.util.Random;

/**
 *
 * @author manolo
 */
public class EscalaVectorParalelo extends Thread {

    /**
     * Tamaño del vector
     */
    private int n;   
    /**
     * Factor de escala
     */
    private int k;
    /**
     * Vector de enteros
     */
    private static int[] vector;
     /**
     * Limites de los hilos
     */
    private int limInf, limSup;

    public EscalaVectorParalelo(int n, int k, int inf, int sup) {
        this.n = n;
        this.k = k;
        this.limInf = inf;
        this.limSup = sup;
        vector = new int[n];
        Random rm = new Random();
        for (int i = 0; i < n; ++i) {
            this.vector[i] = rm.nextInt(5);
        }
    }

    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
    }

    public int[] getVector() {
        return vector;
    }

    public void setVector(int[] vector) {
        this.vector = vector;
    }

    public int getVector(int index) {
        return this.vector[index];
    }

    public void setVector(int index, int m) {
        this.vector[index] = m;
    }
  
    public int getK() {
        return k;
    }

    public void setK(int k) {
        this.k = k;
    }

    public int getLimInf() {
        return limInf;
    }

    public void setLimInf(int limInf) {
        this.limInf = limInf;
    }

    public int getLimSup() {
        return limSup;
    }

    public void setLimSup(int limSup) {
        this.limSup = limSup;
    }
    
    @Override
      public void run(){
      for(int i = limInf; i < limSup; ++i){
	     vector[i] *= k;
	  }   
   }
}
